+2005-09-26 Federico Mena Quintero <federico@ximian.com>
+
+ Do not create the save mode-specific widgets in the open modes, so
+ that we don't carry their baggage around.
+
+ * gtk/gtkfilechooserdefault.c
+ (gtk_file_chooser_default_constructor): Don't create the
+ save_widgets here.
+ (save_widgets_create): Set the impl->save_widgets directly here,
+ instead of passing the widgets back to the caller. Also, pack
+ them into the impl's box.
+ (update_appearance): Create or destroy the save widgets as
+ appropriate. Set the action of the save_file_name_entry here.
+ (shortcuts_add_current_folder): Set the active item in the
+ save_folder_combo only if it exists.
+ (gtk_file_chooser_default_set_property): Don't set the action of
+ the save_file_name_entry here.
+ (gtk_file_chooser_default_update_current_folder): Set the base
+ folder of the save_file_name_entry only if the entry exists.
+ (shortcuts_drag_data_received_cb): Cast the selection_data->data
+ to (const char *) since that's what shortcuts_drop_uris() expects.
+ (file_list_drag_data_received_cb): Likewise, for
+ g_uri_list_extract_uris().
+
2005-09-26 Tor Lillqvist <tml@novell.com>
* gdk/win32/gdkwindow-win32.c (gdk_window_shape_combine_mask): Set
+2005-09-26 Federico Mena Quintero <federico@ximian.com>
+
+ Do not create the save mode-specific widgets in the open modes, so
+ that we don't carry their baggage around.
+
+ * gtk/gtkfilechooserdefault.c
+ (gtk_file_chooser_default_constructor): Don't create the
+ save_widgets here.
+ (save_widgets_create): Set the impl->save_widgets directly here,
+ instead of passing the widgets back to the caller. Also, pack
+ them into the impl's box.
+ (update_appearance): Create or destroy the save widgets as
+ appropriate. Set the action of the save_file_name_entry here.
+ (shortcuts_add_current_folder): Set the active item in the
+ save_folder_combo only if it exists.
+ (gtk_file_chooser_default_set_property): Don't set the action of
+ the save_file_name_entry here.
+ (gtk_file_chooser_default_update_current_folder): Set the base
+ folder of the save_file_name_entry only if the entry exists.
+ (shortcuts_drag_data_received_cb): Cast the selection_data->data
+ to (const char *) since that's what shortcuts_drop_uris() expects.
+ (file_list_drag_data_received_cb): Likewise, for
+ g_uri_list_extract_uris().
+
2005-09-26 Tor Lillqvist <tml@novell.com>
* gdk/win32/gdkwindow-win32.c (gdk_window_shape_combine_mask): Set
impl->shortcuts_current_folder_active = success;
}
- if (success)
+ if (success && impl->save_folder_combo != NULL)
gtk_combo_box_set_active (GTK_COMBO_BOX (impl->save_folder_combo), pos);
}
position -= bookmarks_index;
if (selection_data->target == gdk_atom_intern_static_string ("text/uri-list"))
- shortcuts_drop_uris (impl, selection_data->data, position);
+ shortcuts_drop_uris (impl, (const char *) selection_data->data, position);
else if (selection_data->target == gdk_atom_intern_static_string ("GTK_TREE_MODEL_ROW"))
shortcuts_reorder (impl, position);
chooser = GTK_FILE_CHOOSER (data);
/* Parse the text/uri-list string, navigate to the first one */
- uris = g_uri_list_extract_uris (selection_data->data);
+ uris = g_uri_list_extract_uris ((const char *) selection_data->data);
if (uris[0])
{
uri = uris[0];
return vbox;
}
+
/* Callback used when the "Browse for more folders" expander is toggled */
static void
expander_changed_cb (GtkExpander *expander,
}
/* Creates the widgets specific to Save mode */
-static GtkWidget *
+static void
save_widgets_create (GtkFileChooserDefault *impl)
{
GtkWidget *vbox;
GtkWidget *widget;
GtkWidget *alignment;
+ if (impl->save_widgets != NULL)
+ return;
+
vbox = gtk_vbox_new (FALSE, 12);
table = gtk_table_new (2, 2, FALSE);
impl);
gtk_widget_show_all (alignment);
- return vbox;
+ impl->save_widgets = vbox;
+ gtk_box_pack_start (GTK_BOX (impl), impl->save_widgets, FALSE, FALSE, 0);
+ gtk_box_reorder_child (GTK_BOX (impl), impl->save_widgets, 0);
+ gtk_widget_show (impl->save_widgets);
+}
+
+/* Destroys the widgets specific to Save mode */
+static void
+save_widgets_destroy (GtkFileChooserDefault *impl)
+{
+ if (impl->save_widgets == NULL)
+ return;
+
+ gtk_widget_destroy (impl->save_widgets);
+ impl->save_widgets = NULL;
+ impl->save_file_name_entry = NULL;
+ impl->save_folder_label = NULL;
+ impl->save_folder_combo = NULL;
+ impl->save_expander = NULL;
}
/* Creates the main hpaned with the widgets shared by Open and Save mode */
shortcuts_model_create (impl);
- /* Widgets for Save mode */
- impl->save_widgets = save_widgets_create (impl);
- gtk_box_pack_start (GTK_BOX (impl), impl->save_widgets, FALSE, FALSE, 0);
-
/* The browse widgets */
impl->browse_widgets = browse_widgets_create (impl);
gtk_box_pack_start (GTK_BOX (impl), impl->browse_widgets, TRUE, TRUE, 0);
{
const char *text;
- gtk_widget_show (impl->save_widgets);
+ save_widgets_create (impl);
if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
text = _("Save in _folder:");
gtk_label_set_text_with_mnemonic (GTK_LABEL (impl->save_folder_label), text);
+ _gtk_file_chooser_entry_set_action (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry), impl->action);
+
if (gtk_expander_get_expanded (GTK_EXPANDER (impl->save_expander)))
{
gtk_widget_set_sensitive (impl->save_folder_label, FALSE);
else if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
{
- gtk_widget_hide (impl->save_widgets);
+ save_widgets_destroy (impl);
gtk_widget_show (impl->browse_widgets);
}
else
gtk_widget_show (impl->browse_new_folder_button);
+ /* This *is* needed; we need to redraw the file list because the "sensitivity"
+ * of files may change depending whether we are in a file or folder-only mode.
+ */
gtk_widget_queue_draw (impl->browse_files_tree_view);
g_signal_emit_by_name (impl, "default-size-changed");
impl->action = action;
update_appearance (impl);
}
-
- if (impl->save_file_name_entry)
- _gtk_file_chooser_entry_set_action (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry),
- action);
}
break;
/* Set the folder on the save entry */
- _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry),
- impl->current_folder);
+ if (impl->save_file_name_entry)
+ _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry),
+ impl->current_folder);
/* Create a new list model. This is slightly evil; we store the result value
* but perform more actions rather than returning immediately even if it
g_assert_not_reached ();
}
}
- else if (current_focus == impl->save_file_name_entry)
+ else if ((impl->save_file_name_entry != NULL) && (current_focus == impl->save_file_name_entry))
{
GtkFilePath *path;
gboolean is_well_formed, is_empty, is_file_part_empty;